package test;

import java.text.ParseException;
import java.util.Date;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.yj.model.Role;
import com.yj.service.RoleService;
import com.yj.utils.DateUtil;
import com.yj.utils.Md5Class;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:beans.xml")
public class CCST {

	@Resource
	private RoleService roleService;
	
//	@Test
	public void roleTest() {
//		Role role = new Role("教师");
//		roleService.save(role);
		Role role = new Role("管理员");
		role.setId(3);
		roleService.update(role);
	}
	
//	@Test
	public void Md5String() {
		String password = "123456";
		System.out.println(Md5Class.stringToMd5(password));
	}
	
    @Test
    public void dateUtilTest() throws ParseException {
		Long now = new Date().getTime();
		String longDate = DateUtil.toLongDate(now);
	    System.out.println(DateUtil.toLong(longDate));
    }
}
